﻿namespace KinonekoSoftware.Studio.Pages.Notions
{
    /// <summary>
    /// <see cref="NotionEditorViewModel"/> 类型表示XX设定的灵感。
    /// </summary>
    public sealed partial class NotionEditorViewModel : TabViewModelCore
    {
        private readonly NotionEngine _engine_notion;

        private readonly ObservableStack<INotion> _notionStack;
        private readonly List<INotion>            _notionCollection;

        private NotionDraft _Draft;

        public NotionEditorViewModel()
        {
            _engine_notion    = Platform.GetEngine<NotionEngine>();
            _notionStack      = new ObservableStack<INotion>();
            _notionCollection = new List<INotion>(32);
            Notions           = new ObservableCollection<INotion>();
            Impressions       = new ObservableCollection<Impression>();
            Removable         = true;
            EnableSafetyExit  = true;
        }

        protected override void OnReceive(PageContext context)
        {
            if (context.Has(ContextBase.Key_Value))
            {
                _Draft = context.GetObject<NotionDraft>(ContextBase.Key_Value);

                //
                //
                SetTitle(_Draft.Name);
            }


            base.OnReceive(context);
        }

        protected override void OnStart()
        {
            //
            //
            Impressions.AddMany(_Draft.Impressions, true);
            base.OnStart();
        }

        public void SetTitle(string title)
        {
            Title = $"讨论: {title}";
        }

        public INotion Draft => _Draft;

        public ObservableCollection<Impression> Impressions { get; }
    }

    /*
     * Notion
     *
     * 设定 + 标签
     * 设定 + 印象
     *
     *
     */
}